package com.example.dto;

import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

import java.util.Date;
import java.util.List;
import java.util.Map;

/**
 * 签到响应DTO
 * 用于返回签到操作结果
 */
@Data
@Schema(description = "签到响应数据传输对象")
public class CheckInResponseDTO {

    @Schema(description = "签到是否成功", example = "true")
    private Boolean success;

    @Schema(description = "响应消息", example = "签到成功")
    private String message;

    @Schema(description = "签到时间", example = "2025-08-25 14:30:00")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date signTime;

    @Schema(description = "用户信息")
    private UserInfo userInfo;

    @Schema(description = "讲座信息")
    private LectureInfo lectureInfo;

    @Schema(description = "批量签到结果（批量操作时使用）")
    private BatchResult batchResult;

    /**
     * 用户信息内部类
     */
    @Data
    @Schema(description = "用户信息")
    public static class UserInfo {
        @Schema(description = "用户ID", example = "1001")
        private Long userId;

        @Schema(description = "用户名", example = "张三")
        private String username;

        @Schema(description = "邮箱", example = "zhangsan@example.com")
        private String email;
    }

    /**
     * 讲座信息内部类
     */
    @Data
    @Schema(description = "讲座信息")
    public static class LectureInfo {
        @Schema(description = "讲座ID", example = "2001")
        private Long lectureId;

        @Schema(description = "讲座标题", example = "Java并发编程实战")
        private String title;

        @Schema(description = "主讲人", example = "张教授")
        private String lecturer;

        @Schema(description = "开始时间", example = "2025-08-25 14:00:00")
        @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
        private Date startTime;
    }

    /**
     * 批量签到结果内部类
     */
    @Data
    @Schema(description = "批量签到结果")
    public static class BatchResult {
        @Schema(description = "总处理数量", example = "10")
        private Integer totalCount;

        @Schema(description = "成功数量", example = "8")
        private Integer successCount;

        @Schema(description = "失败数量", example = "2")
        private Integer failureCount;

        @Schema(description = "成功列表")
        private List<String> successList;

        @Schema(description = "失败列表")
        private List<Map<String, Object>> failureList;
    }
}